#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char const *argv[])
{
    vector<short> num;
    int n, sum;
    int i, j, k, l, r, w;
    cin >> n;
    sum = 0;
    for (i = 2; sum < n; i++)
    {
        sum += i;
    }
    i--;
    k = sum - n;
    l = 2;
    r = i;
    if (k == 1)
    {
        l++;
        r++;
    }
    num.push_back(1);
    for (i = l; i <= r; i++)
    {
        if (i == k)
        {
            continue;
        }
        for (j = 0; j < num.size(); j++)
        {
            num[j] *= i;
        }
        for (j = 0; j < num.size() - 1; j++)
        {
            num[j + 1] += num[j] / 10;
            num[j] %= 10;
        }
        w = num.back() / 10;
        num[num.size() - 1] %= 10;
        while (w)
        {
            num.push_back(w % 10);
            w /= 10;
        }
        cout << i << " ";
    }
    cout << "\n";
    reverse(num.begin(), num.end());
    for (i = 0; i < num.size(); i++)
    {
        cout << num[i];
    }
    return 0;
}
